package com.ruoyi.activiti.listener;

import org.activiti.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;

/**
 * 请假会签任务监听器，当会签任务完成时统计同意的数量
 * @author henryyan
 */
@Component
public class LeaveCounterSignCompleteListener{
    public void counter(DelegateExecution delegateTask, String approvedVariableName, String countVariableName) {
        if ("true".equals(delegateTask.getVariable(approvedVariableName))) {
            Long agreeCounter = (Long) delegateTask.getVariable(countVariableName);
            delegateTask.setVariable(countVariableName, agreeCounter + 1);
        }
    }
}